* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #0c0c2e 0%, #1a1a3e 50%, #0a0a1a 100%);
    color: #fff;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    overflow: hidden;
    padding: 0;
    width: 100vw;
    height: 100vh;
}

.game-container {
    position: relative;
    width: 100%;
    height: 100%;
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.game-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    padding: 12px 20px;
    background: linear-gradient(90deg, rgba(20, 20, 60, 0.9) 0%, rgba(30, 30, 80, 0.9) 100%);
    border-bottom: 2px solid #4deeea;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.5);
    z-index: 100;
    flex-shrink: 0;
}

.game-title {
    font-size: 1.8rem;
    font-weight: bold;
    color: #4deeea;
    text-shadow: 0 0 15px rgba(77, 238, 234, 0.8);
    display: flex;
    align-items: center;
    gap: 10px;
}

.stats {
    display: flex;
    gap: 25px;
}

.stat {
    display: flex;
    flex-direction: column;
    align-items: center;
    position: relative;
    min-width: 70px;
}

.stat-icon {
    font-size: 1.2rem;
    margin-bottom: 5px;
    color: #ffea00;
}

.stat-value {
    font-size: 1.5rem;
    font-weight: bold;
    color: #ffea00;
    text-shadow: 0 0 10px rgba(255, 234, 0, 0.7);
}

.stat-label {
    font-size: 0.9rem;
    color: #aaa;
    margin-top: 2px;
}

.game-canvas-container {
    position: relative;
    width: 100%;
    flex-grow: 1;
    overflow: hidden;
    background-color: #050510;
    border-radius: 0;
}

#gameCanvas {
    display: block;
    width: 100%;
    height: 100%;
    background-color: #0a0a1a;
}

.controls-container {
    display: flex;
    justify-content: space-between;
    width: 100%;
    padding: 15px 20px;
    background: linear-gradient(0deg, rgba(10, 10, 30, 0.95) 0%, rgba(20, 20, 50, 0.9) 100%);
    border-top: 2px solid #4deeea;
    box-shadow: 0 -5px 15px rgba(0, 0, 0, 0.5);
    flex-shrink: 0;
}

.left-controls, .right-controls {
    display: flex;
    align-items: center;
}

.dpad {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
}

.dpad-horizontal {
    display: flex;
    gap: 70px;
}

.control-btn {
    width: 70px;
    height: 70px;
    border: none;
    border-radius: 50%;
    background: linear-gradient(145deg, rgba(60, 60, 100, 0.9), rgba(40, 40, 70, 0.9));
    color: white;
    font-size: 1.8rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    box-shadow: 0 8px 0 rgba(20, 20, 40, 0.8),
                0 0 15px rgba(77, 238, 234, 0.3);
    transition: all 0.1s;
    user-select: none;
    cursor: pointer;
    position: relative;
}

.control-btn .btn-label {
    font-size: 0.7rem;
    margin-top: 2px;
    font-weight: normal;
}

.control-btn:active {
    transform: translateY(8px);
    box-shadow: 0 0 10px rgba(77, 238, 234, 0.5);
}

.move-up {
    background: linear-gradient(145deg, #4d79ff, #1a53ff);
    box-shadow: 0 8px 0 rgba(26, 83, 255, 0.8),
                0 0 15px rgba(77, 121, 255, 0.5);
}

.move-left, .move-right {
    background: linear-gradient(145deg, #4d79ff, #1a53ff);
    box-shadow: 0 8px 0 rgba(26, 83, 255, 0.8),
                0 0 15px rgba(77, 121, 255, 0.5);
}

.move-down {
    background: linear-gradient(145deg, #4d79ff, #1a53ff);
    box-shadow: 0 8px 0 rgba(26, 83, 255, 0.8),
                0 0 15px rgba(77, 121, 255, 0.5);
}

.action-btn {
    background: linear-gradient(145deg, #ff4d4d, #e60000);
    box-shadow: 0 8px 0 rgba(179, 0, 0, 0.8),
                0 0 15px rgba(255, 77, 77, 0.5);
}

.jump-btn {
    background: linear-gradient(145deg, #4dff88, #00cc44);
    box-shadow: 0 8px 0 rgba(0, 179, 60, 0.8),
                0 0 15px rgba(77, 255, 136, 0.5);
}

.special-btn {
    background: linear-gradient(145deg, #ffcc00, #ff9900);
    box-shadow: 0 8px 0 rgba(179, 107, 0, 0.8),
                0 0 15px rgba(255, 204, 0, 0.5);
}

.right-controls {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.game-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: radial-gradient(circle, rgba(10, 10, 30, 0.95) 0%, rgba(5, 5, 20, 0.98) 100%);
    z-index: 1000;
}

.overlay-content {
    text-align: center;
    padding: 30px;
    max-width: 90%;
    background: rgba(20, 20, 50, 0.8);
    border-radius: 20px;
    border: 2px solid #4deeea;
    box-shadow: 0 0 40px rgba(77, 238, 234, 0.5);
    backdrop-filter: blur(10px);
}

.overlay-title {
    font-size: 3rem;
    color: #ffea00;
    margin-bottom: 25px;
    text-shadow: 0 0 20px rgba(255, 234, 0, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 15px;
}

.overlay-text {
    font-size: 1.4rem;
    margin-bottom: 30px;
    line-height: 1.6;
    color: #ddd;
}

.btn {
    padding: 18px 40px;
    font-size: 1.4rem;
    background: linear-gradient(145deg, #4d79ff, #1a53ff);
    color: white;
    border: none;
    border-radius: 50px;
    cursor: pointer;
    transition: all 0.3s;
    font-weight: bold;
    margin: 10px;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.4);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.btn:hover {
    transform: translateY(-5px);
    box-shadow: 0 12px 25px rgba(0, 0, 0, 0.5);
}

.btn:active {
    transform: translateY(2px);
}

.btn-start {
    background: linear-gradient(145deg, #4dff88, #00cc44);
    box-shadow: 0 8px 20px rgba(0, 204, 68, 0.3);
}

.hidden {
    display: none !important;
}

.game-instructions {
    position: absolute;
    bottom: 120px;
    left: 0;
    width: 100%;
    padding: 10px 20px;
    font-size: 0.9rem;
    color: #aaa;
    text-align: center;
    line-height: 1.4;
    background: rgba(10, 10, 30, 0.7);
    backdrop-filter: blur(5px);
    z-index: 50;
}

.mobile-note {
    color: #4deeea;
    margin-top: 20px;
    font-size: 1rem;
    font-style: italic;
}

.control-hint {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 15px;
    margin: 25px 0;
}

.hint-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
}

.hint-key {
    width: 50px;
    height: 50px;
    background: rgba(77, 238, 234, 0.2);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    color: #4deeea;
}

.hint-text {
    font-size: 0.9rem;
    color: #aaa;
}

/* 响应式设计 */
@media (max-width: 1024px) {
    .game-title {
        font-size: 1.5rem;
    }
    
    .stat {
        min-width: 60px;
    }
    
    .stat-value {
        font-size: 1.3rem;
    }
    
    .control-btn {
        width: 65px;
        height: 65px;
        font-size: 1.6rem;
    }
    
    .dpad-horizontal {
        gap: 60px;
    }
}

@media (max-width: 768px) {
    .game-header {
        padding: 10px 15px;
    }
    
    .game-title {
        font-size: 1.3rem;
    }
    
    .stats {
        gap: 15px;
    }
    
    .stat {
        min-width: 55px;
    }
    
    .stat-value {
        font-size: 1.2rem;
    }
    
    .stat-label {
        font-size: 0.8rem;
    }
    
    .control-btn {
        width: 60px;
        height: 60px;
        font-size: 1.5rem;
    }
    
    .dpad-horizontal {
        gap: 50px;
    }
    
    .overlay-title {
        font-size: 2.2rem;
    }
    
    .overlay-text {
        font-size: 1.2rem;
    }
    
    .btn {
        padding: 15px 30px;
        font-size: 1.2rem;
    }
    
    .game-instructions {
        bottom: 110px;
        font-size: 0.8rem;
    }
}

@media (max-width: 480px) {
    .game-header {
        padding: 8px 10px;
    }
    
    .game-title {
        font-size: 1.1rem;
    }
    
    .stats {
        gap: 10px;
    }
    
    .stat {
        min-width: 45px;
    }
    
    .stat-icon {
        font-size: 1rem;
    }
    
    .stat-value {
        font-size: 1rem;
    }
    
    .stat-label {
        font-size: 0.7rem;
    }
    
    .controls-container {
        padding: 10px 15px;
    }
    
    .control-btn {
        width: 55px;
        height: 55px;
        font-size: 1.3rem;
    }
    
    .control-btn .btn-label {
        font-size: 0.6rem;
    }
    
    .dpad-horizontal {
        gap: 40px;
    }
    
    .overlay-title {
        font-size: 1.8rem;
    }
    
    .overlay-text {
        font-size: 1rem;
    }
    
    .btn {
        padding: 12px 24px;
        font-size: 1rem;
    }
    
    .game-instructions {
        bottom: 100px;
        font-size: 0.7rem;
        padding: 8px 10px;
    }
}

/* 横屏优化 */
@media (max-height: 600px) and (orientation: landscape) {
    .game-header {
        padding: 8px 15px;
    }
    
    .game-title {
        font-size: 1.2rem;
    }
    
    .stats {
        gap: 15px;
    }
    
    .stat {
        min-width: 50px;
    }
    
    .controls-container {
        padding: 8px 15px;
    }
    
    .control-btn {
        width: 50px;
        height: 50px;
        font-size: 1.2rem;
    }
    
    .dpad-horizontal {
        gap: 35px;
    }
    
    .game-instructions {
        display: none;
    }
}

/* 动画效果 */
@keyframes pulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.05); }
    100% { transform: scale(1); }
}

.pulse {
    animation: pulse 2s infinite;
}